using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;

namespace Kiwi.Container.Wcf
{
    public class CallTrackingDispatchMessageInspector : IDispatchMessageInspector
    {
        #region IDispatchMessageInspector Members

        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            WcfRequestContainerActivator.WcfCallActive = true;
            return null;
        }

        public void BeforeSendReply(ref Message reply, object correlationState)
        {
            WcfRequestContainerActivator.WcfCallActive = false;
        }

        #endregion
    }
}